﻿Imports System.Data.OleDb
Imports DTO
Public Class BoPhanDAO
    Public Function laybophan() As List(Of BoPhanDTOvb)
        Dim sql = "select MaBoPhan,TenBoPhan from BoPhan"
        Dim con As OleDbConnection = DatabaseProvider.connectData()
        Dim cmd As New OleDbCommand(sql, con)
        Dim reader As OleDbDataReader = cmd.ExecuteReader()
        Dim danhsach As New List(Of BoPhanDTOvb)
        While reader.Read()
            Dim bpDTO As New BoPhanDTOvb()
            bpDTO.MaBoPhan = reader("MaBoPhan")
            bpDTO.TenBoPhan = reader("TenBoPhan")
            danhsach.Add(bpDTO)
        End While
        con.Close()
        Return danhsach
    End Function
End Class
